package com.biz.primus.ms.sms.dao.repository;

import com.biz.primus.ms.sms.dao.po.CenterChannel;
import com.biz.primus.ms.sms.projection.ChannelCheckProjection;
import com.google.common.base.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;


/**
 * @author yanweijin
 * @date 2017/5/30
 */
public interface ChannelRepository extends JpaRepository<CenterChannel, Long> {


    Optional<CenterChannel> findByChannelCode(String channelCode);

    @Query("select enable as enable, token as token from CenterChannel where channelCode = ?1")
    Optional<ChannelCheckProjection> findByChannelCodeAsProjection(String channelCode);


}
